package com.alex.zookeeper.crud;

import com.alex.zookeeper.BaseTest;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.data.Stat;
import org.junit.Test;

import java.util.List;

/**
 * 获取子节点
 */
public class ZKGetChildren extends BaseTest {

    @Test
    public void sync() throws Exception {
        // res: PATH下的子节点集合
        List<String> childrenList = zooKeeper.getChildren(PATH, false);
    }

    @Test
    public void async() throws Exception {
        zooKeeper.getChildren(PATH, false, new AsyncCallback.Children2Callback() {
            @Override
            public void processResult(int i, String s, Object o, List<String> list, Stat stat) {

            }
        }, "getChildren");
    }
}
